
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
    <title>用户${id==null?"添加":"修改"}</title>
</head>
<body>
  <form action="${pageContext.request.contextPath}/user_edit" method="post">
        <s:set name="departmentId" value="%{department.id}"></s:set>
        <input type="hidden" name="id" value="${id}">
        用户名:<input type="text" name="username" value="${username}"><br>
        昵称：<input type="text" name="nickname" value="${nickname}"><br>
        Email:<input type="email" name="email" value="${email}"><br>
        选择部门:
        <select name="departmentId">
            <option ${id==null?"selected":""}>请选择部门</option>
        <s:iterator value="#departments">
            <option name="departmentIds" value="${id}" ${id == departmentId?"selected":""}>
                ${name}
            </option>
        </s:iterator>
        </select>
        选择角色：
        <select multiple name="roleIds">
        <s:iterator value="#roles">
            <option value="${id}" <s:if test="%{id in roleIds}">selected</s:if> >
                ${name}
            </option>
        </s:iterator>
        </select>
        <button type="submit" id="btn1">提交</button>
  </form>
    <s:debug></s:debug>
</body>
</html>
